<template>
  <section class="main">
    <input id="toggle-all" class="toggle-all" type="checkbox" />
    <label for="toggle-all">Mark all as complete</label>
    <ul class="todo-list">
      <!-- completed: 完成的类名 -->
      <li
        v-for="(item, index) in arr"
        :key="item.id"
        :class="{ completed: item.isDone }"
      >
        <div class="view">
          <input class="toggle" type="checkbox" v-model="item.isDone" />
          <label>{{ item.name }}</label>
          <button @click="del(index)" class="destroy"></button>
        </div>
      </li>
    </ul>
  </section>
</template>

<script>
export default {
  props: ["arr"],
  methods: {
    del(index) {
      this.$emit("delMain", index);
    },
  },
};
</script>